package com.atguigu.yygh.oss.controller;/*
 * @author: XueYouPeng
 * @time: 2023/6/14 22:19
 */

import com.atguigu.common.result.Result;
import com.atguigu.yygh.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oss")
public class OssController {

    @Autowired
    OssService ossService;

    @PostMapping("upload")
    public Result upload(MultipartFile file){
        String url = ossService.upload(file);
        return Result.ok().message("文件上传成功").data("url",url);
    }
}
